<?php

namespace tool;

use phpspirit\databackup\RecoveryFactory;
use think\facade\Db;

class SqlRestore
{
    public function SynRestore()
    {
        $recovery = RecoveryFactory::instance('mysql', Db::getConfig('connections.mysql.hostname') . ":" . Db::getConfig('connections.mysql.hostport'), Db::getConfig('connections.mysql.database'), Db::getConfig('connections.mysql.username'), Db::getConfig('connections.mysql.password'));
        $result = $recovery->setSqlfiledir(root_path() . DIRECTORY_SEPARATOR . 'public' . DIRECTORY_SEPARATOR . 'backdir')->ajaxrecovery($_POST);
        return $result;
    }
}
